<?php
require_once('../Inc/Global.php');
require_once('../DatabaseProject/EcsProductsMgmt/ProductsData.php');
require_once('../MembersOnly/Authentication.php');
require_once('ShoppingCart.php');
$rs = GetProduct($_REQUEST['ID']);

//$action=(isset($_GET['action']) && $_GET['action'] !='') ? $_GET['action'] : 'view';

switch($action)
{
	case 'add':
		addToCart();
		break;
	case 'update':
		updateCart();
		break;
	case 'delete':
		deleteFromCart();
		break;
	case 'view':
	
}
?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="ECommCss.css" />
<!-- Tab Icon -->
<link rel="shortcut icon" href="http://mobilitysite.com/wp-content/uploads/2007/08/mlb.jpg"> 
<title>Shopping Cart</title>
</head>
<body>
<img src="http://www.bpsportscards.com/images/store_version1/storelogo/BP%20Cards.jpg"
	alt="BP Sports Cards" width="640" height="170" class="float" />
	<br/>
	<br/>
	<br/>
	
	<?
if(IsLoggedIn())
{
	?><div>Welcome <?=GetUserName()?><div> <input type="button" value="Log Out" onclick="window.location.href='http://cs.newpaltz.edu/~N00001387/WebClass/WebClass/MembersOnly/LogOut.php'" />
	 <div>Logged in as: <?=GetUserClearance()?><div>
	  
<?
}
else
{
	?>
	  <a href="../MembersOnly/Login.php">Click Here to Log In</a>
	  <br/>
	  <a href="../DatabaseProject/UserManagement/EditUser.php">New user? Click here to create an account</a>
	  <br />
	  <br />	 
	  <br />
	  <br />	
	  <br /> 
	 <?
}
?>
<h3>Shopping Cart</h3>
<div>You have added: </div>
<table border="1">
	<tr>
		<th>Product Name</th>
        <th>Manufacturer</th>
        <th>Condition</th>
        <th>Sport Type</th>
        <th>Product Type</th>
        <th>Sale Price</th>
  		<th>Quantity</th>      
        <?if(GetUserClearance() !='Administrator')
        {?>
        <th>Cart Options</th>
        <?}?>
    </tr>
	<tr>
	                 		
    <td><?=$rs['ProductName']?></td>
    <td><?=$rs['Manufacturer']?></td>
    <td><?=$rs['Condit']?></td>
    <td><?=$rs['Sport_Type']?></td>
    <td><?=$rs['Product_Type']?></td>
    <?$salePrice=$rs['SalePrice']?>
    <td align="right">&#36;<?=$salePrice?></td>
    <td width="20" align="center"><input name="rowqty" type="text" value="1" maxlength="2" size="4"></input></td>
    <td>Remove</td>
               
   </tr> 
   <tr>
   	<td colspan="7" align="right">Subtotal: $<?=$salePrice?></td>
   </tr>
   </table>
   <input type="button" value="Continue Shopping" onclick="window.location.href='http://cs.newpaltz.edu/~N00001387/WebClass/WebClass/ECommSite/Products.php'" />
   <input type="button" value="Update" onclick="window.location.href='http://cs.newpaltz.edu/~N00001387/WebClass/WebClass/ECommSite/Products.php'" />
   <input type="button" value="Proceed to Checkout" onclick="window.location.href='http://cs.newpaltz.edu/~N00001387/WebClass/WebClass/Shopping/'" />
   </body>
   </html>
